package load;



import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/29 10:32
 */
public class UserTest {
    public static void main(String[] args) {

        UserDaoImp userDaoImp = new UserDaoImp();
        User user = new User();
        Scanner in = new Scanner(System.in);
        while (true){
            System.out.println("--------欢迎光临--------");
            System.out.println("1.登录");
            System.out.println("2.注册");
            System.out.println("3.退出");
            System.out.println("请输入你的选择：");
            int n=in.nextInt();
            if (n==1){
                System.out.println("--------登录界面--------");
                in.nextLine();
                System.out.println("请输入用户名：");
                String strname=in.nextLine();
                System.out.println("请输入密码：");
                String passwords=in.nextLine();
                if (userDaoImp.login(strname,passwords)){
                    System.out.println("登录成功，开始游戏");
                    int a=in.nextInt();
                }
                else{
                    System.out.println("登录失败");
                }
            }
            if (n==2){
                System.out.println("请输入用户名：");
                in.nextLine();
                user.setUserName(in.nextLine());
                System.out.println("请输入密码：");
                user.setPassword(in.nextLine());
                userDaoImp.regist(user);
            }
            if (n==3){
                System.out.println("欢迎下次使用！");
                break;
            }
        }
    }
}
